package com.lanchetech.user.controller;

import com.lanchetech.bean.request.PageReq;
import com.lanchetech.bean.request.UserVoucherReq;
import com.lanchetech.bean.response.BasePageResp;
import com.lanchetech.bean.response.BaseResp;
import com.lanchetech.bean.response.OrderResp;
import com.lanchetech.bean.response.ResultData;
import com.lanchetech.bean.vo.UserVoucherVO;
import com.lanchetech.entity.User;
import com.lanchetech.user.service.OperatorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;


@Api(value = "运营员工操作管理", tags = "店员管理")
@RequestMapping("/api/operator")
@RestController
public class OperatorController {

    @Autowired
    OperatorService operatorService;

    @ApiOperation("发放兑换卡礼品券")
    @GetMapping("/sendUserVoucher")
    public BaseResp sendUserVoucher(@AuthenticationPrincipal User user, @RequestParam("username") String username, @RequestParam("spuId") Long spuId) {
        return operatorService.sendUserVoucher(user, username, spuId);
    }

    @ApiOperation("获取兑换卡礼品券发放记录分页")
    @PostMapping("/getGiftUserVoucherPage")
    public ResultData<BasePageResp<UserVoucherVO>> getGiftUserVoucherPage(@AuthenticationPrincipal User user, @RequestBody UserVoucherReq req) {
        return operatorService.getGiftUserVoucherPage(user, req);
    }
}
